package com.ssy.invoicing.suppliers.service;

import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ssy.invoicing.dao.support.BaseSqlDao.SplitPageResult;
import com.ssy.invoicing.suppliers.bean.SuppliersBean;
import com.ssy.invoicing.suppliers.dao.SuppliersDao;

/**
 * Comment of CustomerService
 * @author suoyao.shen
 */
@Service(value="suppliersService")
@Transactional
public class SuppliersService {
    
    @Resource(name="suppliersDao")
    private SuppliersDao suppliersDao;

    /**
     * 查询供应商信息
     * @author suoyao.shen
     * @return
     * @throws SQLException
     */
    public SplitPageResult querySuppliersListByPage(Integer page) throws SQLException {
        return suppliersDao.querySuppliersListByPage(null, page == null ? 1 : page.intValue());
    }
    
    /**
     * 查询供应商信息不分页
     * @author suoyao.shen
     * @return
     */
    public List<SuppliersBean> querySuppliersList() {
        return suppliersDao.querySuppliersList();
    }
    
    /**
     * 查询供应商详情
     * @author suoyao.shen
     * @param id
     * @return
     */
    public SuppliersBean getSuppliers(Integer id) {
        return suppliersDao.getSuppliers(id);
    }
    
    /**
     * 删除供应商信息
     * @author suoyao.shen
     * @param id
     */
    public void removeSuppliers(Integer id) {
        suppliersDao.removeSuppliers(id);
    }
    
    /**
     * 保存供应商信息
     * @author suoyao.shen
     * @param customer
     */
    public void saveSuppliers(SuppliersBean suppliers) {
        suppliersDao.saveSuppliers(suppliers);
    }
    
    /**
     * 更新供应商信息
     * @author suoyao.shen
     * @param suppliers
     */
    public void updateSuppliers(SuppliersBean suppliers) {
        suppliersDao.updateSuppliers(suppliers);
    }
    
}
